package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.ProjectType;
import com.cetc39.dao.ProjectTypeDao;

public class ProjectTypeDaoImpl extends HibernateDaoSupport implements ProjectTypeDao {

	@Override
	public void save(ProjectType pt) {
		this.getHibernateTemplate().save(pt);
	}

	@Override
	public void delete(int id) {
		ProjectType pt = this.getHibernateTemplate().get(ProjectType.class, id);
		this.getHibernateTemplate().delete(pt);
	}

	@Override
	public void update(ProjectType pt) {
		this.getHibernateTemplate().saveOrUpdate(pt);
	}

	@Override
	public List<?> findAll() {
		List<?> ptList = this.getHibernateTemplate().find("FROM ProjectType");
		return ptList;
	}

	@Override
	public ProjectType findById(int id) {
		ProjectType pt = this.getHibernateTemplate().get(ProjectType.class, id);
		return pt;
	}
	
}
